
<!-- <{include file="www/activity/create_status_bar.tpl"}> -->

<script>
function form_times_submit (formItem)
{
    var days = global_kal.getSelected();
    if (! days)
    {
        layer.msg("请选择您的空闲日期");
        return false;
    }
    $(formItem).find('input[name=freeTimeDays]').val(days);
    return true;
}

$(document).ready(function () {

    var d1 = new Kalendae.Input('startD', {
            attachTo: document.getElementById('startD'),
			months:1,
            weekStart: 1,
			mode:'single',
            useYearNav: false,
            columnHeaderFormat: "dd",
            titleFormat: "YYYY年MM月",
            format: 'YYYY-MM-DD',
            blackout : function (x) {
                return false;
            },

            'subscribe' : {
                'date-clicked' : function (date) {
                    global_kal.draw(); 
                    $('input[name=tipsStartDay]').val(date.format('YYYY-MM-DD'));
                }
            },
		});

    var d2 = new Kalendae.Input('endD', {
            attachTo: document.getElementById('endD'),
			months:1,
            weekStart: 1,
			mode:'single',
            useYearNav: false,
            columnHeaderFormat: "dd",
            titleFormat: "YYYY年MM月",
            format: 'YYYY-MM-DD',
            blackout : function (x) {

                var day = $('#startD').val();
                if (! day)
                {
                    day = Kalendae.moment().format("YYYY-MM-DD");
                }

                var d = Kalendae.moment(day);
                if(x.isBefore(d))
                    return true;
                d.add(6, 'months');
                if (x.isBefore(d))
                    return false;
                else
                    return true;
 
            },

            'subscribe' : {
                'date-clicked' : function (date) {
                    global_kal.draw(); 
                    //$('input[name=tipsStopDay]').val(date);
                    $('input[name=tipsStopDay]').val(date.format('YYYY-MM-DD'));
                }
            },
		});
});
 


</script>

<form class="times" action="" method="POST" onSubmit="return form_times_submit(this)">

    <img src="/resource/www/imgs/huod_3.png" class="times-img">

    <div class="li fix">
        <span class="text">活动有效期</span>
        <div class="time-wrap">
            <input class="time" type="text" name="startDay" value="<{$activity.startDay}>" id="startD" placeholder="开始时间">
        </div>
        <div class="time-wrap">
            <input class="time" type="text" name="stopDay" value="<{$activity.stopDay}>" id="endD" placeholder="结束时间">

        </div>
    </div>

    <p class="prompt">提示：请注意结合您的路线天数选择连续的时间段</p>

    <div class="li fix">
        <span class="text">快速选择</span>
        <div class="week fix">
            <span class="zhou">周一</span>
            <span class="zhou">周二</span>
            <span class="zhou">周三</span>
            <span class="zhou">周四</span>
            <span class="zhou">周五</span>
            <span class="zhou">周六</span>
            <span class="zhou">周日</span>
        </div>

    </div>
    <div class="li fix">
        <span class="text">进一步选择</span>
        <{include file="www/activity/widget_days.tpl"}>
    </div>

    <input type="hidden" name="freeTimeDays" value="<{$activity.freeTimeDays}>">
    <p class="server-time" onclick="cal_show_result()">浏览您的服务时间</p>

    <div class="click-btn fix">
        <a href="javascript:;" onclick="javascript :history.back(-1);" class="go-back">上一步</a>
        <input type="submit" name="submit1" class="submit" value="下一步">
    </div>

</form>
